<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href='<?php echo base_url()?>'>
<link rel="stylesheet" type="text/css" href="public/common/css/common.css"/>
<link rel="stylesheet" type="text/css" href="public/admin/css/admin.css"/>
<script src="public/common/js/jquery.js"></script>
<script src="public/common/js/plug/wbox/wbox-min.js"></script>
<link rel="stylesheet" type="text/css" href="public/common/js/plug/wbox/wbox/wbox.css">
<script>
$(function(){
	table_show(0);	
	$('.tab ul li').each(function(index){
		$(this).click(function(){
			$('.tab ul li').removeClass('cur');	
			$(this).addClass('cur');
			table_show(index);
		});										  
	});
	$("#image_frame").wBox({
		requestType: "iframe",
		title: "图片管理",
		target:"<?php echo site_url('admin/image/box_show')?>",
		iframeWH:{width:800,height:400}
	});
	$('#product_image').click(function(){
		$('.product_image').show();								   
	});
	$("#product_image").wBox({
		requestType: "iframe",
		title: "图片管理",
		target:"<?php echo site_url('admin/image/box_show/product_image')?>",
		iframeWH:{width:800,height:400}
	});	
	
	$('select[name="category_id"]').val('<?php echo $product->category_id?>');
});
function table_show(index)
{
	$('.table').hide();
	$('.table:eq('+index+')').show();
}
function delete_product_image(obj)
{
	$(obj).parent().remove();
}
</script>
</head>
<body>
<div class="body">
	<div class="main_top"><div class="position left">当前位置 <span>&gt;</span> 内容 <span>&gt;</span> 产品模块 <span>&gt;</span> 管理内容 <span>&gt;</span> 修改内容 </div></div>
        <div class="go_back"><a href="javascript:history.back()">返回</a></div>
    <div class="body_center">
   		<div class="tab left">
            <ul>
               	<li class="cur">基本设置</li>
                <li>高级设置</li>
           </ul>
        </div>
        <div class="clear"></div>
        <?php $product_attribute = unserialize($product->product_attribute);?>
    	<form action="<?php echo site_url('admin/product/edit_product/'.$product->product_id)?>" method="post">
            <!-- 基本设置 start -->
            <table class="table">
                <tr><th width='20%'>参数名</th><th width='55%'>参数值</th><th width='25%'>参数说明</th></tr>
                <tr>
                    <td align="center">标题：</td>
                    <td><input class="input_txt" type="text" name="product_title" value="<?php echo $product->product_title?>" /></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">标志：</td>
                    <td><input type="checkbox" value="1" name="product_zhiding" <?php if($product->product_zhiding == 1):?>checked<?php endif?> />置顶 <input type="checkbox" value="1" name="product_tuijian" <?php if($product->product_tuijian == 1):?>checked<?php endif?> />推荐</td>
                   <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">来源：</td>
                    <td><input class="input_txt" type="text" name="product_source" value="<?php echo $product->product_source?>" /></td>
                   <td>&nbsp;</td>
				</tr>
                <tr>
                    <td align="center">作者：</td>
                    <td><input class="input_txt" type="text" name="product_author" value="<?php echo $product->product_author?>" /></td>
                    <td>&nbsp;</td>
				</tr>
				<tr>
                    <td align="center">缩略图：</td>
                    <td><input id="pic_path" class="input_txt left" type="text" name="product_thumb_image" value="<?php echo $product->product_thumb_image?>" /> <a id="image_frame" href="<?php echo site_url('admin/image/box_show')?>" class="left">上传图片</a></td>
                    <td align="center" id="show_pic_path"><img src="<?php echo $product->product_thumb_image?>" width="100px" height="100px"></td>
                </tr>
                <tr>
                    <td align="center">发布栏目：</td>
                    <td>
                    	<select name="category_id">
                        	<?php if($category_tree):?>
                                    <option value="0">- -请选择栏目- -</option>
                                    <?php echo $category_tree;?>
                                <?php else:?>
                                    <option value='0'>没有对应分类</option>
                                <?php endif;?>
                    	</select>
                    </td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">产品型号：</td>
                    <td><input class="input_txt" type="text" name="product_attribute[model]" value="<?php echo $product_attribute['model']?>" /></td>
                   <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">市场价格：</td>
                    <td><input class="input_txt" type="text" name="product_attribute[market_price]" value="<?php echo $product_attribute['market_price']?>" /></td>
                   <td>&nbsp;</td>
                </tr>
                <tr>
                	<td align="center">详细介绍：</td>
                    <td colspan=2>
                    	<textarea name='product_content' id='ckeditor'><?php echo $product->product_content?></textarea>
						<?php echo display_ckeditor($ckeditor_config)?>
                    </td>
                </tr>
                <tr>
                    <td align="center">购买说明：</td>
                    <td><textarea name="product_attribute[buy_desc]" class="textarea"><?php echo $product_attribute['buy_desc']?></textarea></td>
                   <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">运费：</td>
                    <td><textarea name="product_attribute[shipping]" class="textarea"><?php echo $product_attribute['shipping']?></textarea></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">交易方式：</td>
                    <td><textarea name="product_attribute[buy_type]" class="textarea"><?php echo $product_attribute['buy_type']?></textarea></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">联系方式：</td>
                    <td><textarea name="product_attribute[contact]" class="textarea"><?php echo $product_attribute['contact']?></textarea></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td align="center">上传产品图片：</td>
                    <td><a id="product_image" href="<?php echo site_url('admin/image/box_show/product_image')?>" class="left">上传图片</a></td>
                    <td>&nbsp;</td>
                </tr>
                <tr class="product_image">
                    <td align="center">产品图片：</td>
                    <td colspan="2">
                    	<table>
                        	<tr>
                            	<?php if(! empty($product_attribute['product_image'])):?>
									<?php foreach($product_attribute['product_image'] as $value):?>
                                    <td>
                                        <input type="hidden" name="product_attribute[product_image][]" value="<?php echo $value?>">
                                        <img src="<?php echo $value?>" width="100px" height="100px"> 
                                        <a href="javascript:void(0)" onclick="delete_product_image(this)">删除</a>
                                    </td>
                                    <?php endforeach;?>
                                <?php endif;?>
                            </tr>
                        </table>
                    </td> 
                </tr>
                <tr>
                    <td align="center" colspan="2">
                   		<input type="submit" class="submit" value="提交" /> 
                        &nbsp;&nbsp;
                        <input type="reset" class="reset" value="重置" />
                    </td>
                    <td>&nbsp;</td>
                </tr>
            </table>
            <!-- 基本设置 end -->
            
            <!-- 高级设置 start -->
            <table class="table">
                <tr><th>参数名</th><th>参数值</th><th style='width:400px;'>参数说明</th></tr>
                <tr>
                    <td align="center">页面关键字(SEO)：</td>
                    <td><input class="input_txt" type="text" name="product_keywords" value="<?php echo $product->product_keywords?>" /></td>
                    <td align="center"><span class="red">*</span> 多个关键字用 | 分开</td>
                </tr>
                <tr>
                    <td align="center">页面描述(SEO)：</td>
                    <td><input class="input_txt" type="text" name="product_desc" value="<?php echo $product->product_desc?>" /></td>
                    <td align="center"><span class="red">*</span> 关键字和描述有助于搜索引擎排名</td>
                </tr>
                <tr>
                    <td align="center">是否新窗口打开：</td>
                    <td><input type="radio" value="1" name="product_new_window" <?php if($product->product_new_window == '1'):?>checked<?php endif;?> />是 <input type="radio" name="product_new_window" value="0"  <?php if($product->product_new_window == '0'):?>checked<?php endif;?>  />否</td>
                    <td align="center"><span class="red">*</span> 规定点击之后是在本窗口打开还是新窗口</td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                   		<input type="submit" class="submit" value="提交" /> 
                        &nbsp;&nbsp;
                        <input type="reset" class="reset" value="重置" />
                    </td>
                    <td>&nbsp;</td>
                </tr>
            </table>
            <!-- 高级设置 end -->
   		</form>
    </div>
</div>
</body>
</html>